#pragma once

#include <AVUIAnimatable.h>

namespace AVUI {

class PathSegmentCollection;
class GeometryBuilder;
class PathFigure : public Animatable
{
    friend class PathGeometry;

public:
    DECLARE_ELEMENT(PathFigure, Animatable);

    DECLARE_DEPENDENCY_PROPERTY(StartPoint);
    Point get_StartPoint() { return AVUI::UnboxValue<Point>(GetValue(get_StartPointProperty())); }
    void set_StartPoint(const Point& value) { SetValue(get_StartPointProperty(), AVUI::BoxValue(value)); } 

    DECLARE_DEPENDENCY_PROPERTY(IsFilled);
    bool get_IsFilled() { return AVUI::UnboxValue<bool>(GetValue(get_IsFilledProperty())); }
    void set_IsFilled(bool value) { SetValue(get_IsFilledProperty(), AVUI::BoxValue(value)); } 

    DECLARE_DEPENDENCY_PROPERTY(IsClosed);
    bool get_IsClosed() { return AVUI::UnboxValue<bool>(GetValue(get_IsClosedProperty())); }
    void set_IsClosed(bool value) { SetValue(get_IsClosedProperty(), AVUI::BoxValue(value)); } 

    DECLARE_DEPENDENCY_PROPERTY_BEGIN(Segments);
        DECLARE_ATTRIBUTE_CONTENTPROPERTY();
        DECLARE_ATTRIBUTE_AUTOCREATE();
    DECLARE_DEPENDENCY_PROPERTY_END();
    TRefCountedPtr<PathSegmentCollection> get_Segments() { return (PathSegmentCollection*)(Object*)GetValue(get_SegmentsProperty()); }
    void set_Segments(PathSegmentCollection* pValue) { SetValue(get_SegmentsProperty(), (Object*)pValue); } 

    Rect GetBounds();
    int ClassifyPoint(const Point& pt);

protected:
    virtual TRefCountedPtr<Freezable> CreateInstanceCore() AVUI_OVERRIDE { return object_allocate<PathFigure>().get_Ptr(); }

private:
    static void StaticConstructor();

    void BuildGeometry(GeometryBuilder* pGB);

};


}; // namespace AVUI
